﻿{% extends 'admin/base.html' %}

{%load comm_extras %}

{% block head_soruce %}
<script type="text/javascript" src="/static/common/js/jquery.simplemodal.1.4.min.js"></script> 
<script type="text/javascript" src="/static/admin/js/admin_master.js"></script> 
<script type="text/javascript">
	function checkData(){
		var val = jQuery.trim($("#title").val());
		if(val == ""){
			alert("平台名称不能为空");
			return false;
		}
		val = jQuery.trim($("#url").val());
		if(val == ""){
			alert("平台网址不能为空");
			return false;
		}
		val = jQuery.trim($("#index").val());
		if(val == "" || isNaN(val)){
			alert("序号不能为空");
			return false;
		}
		val = "{{platform.imgurl}}";
		var newVal = jQuery.trim($("#file").val());
		if(val == "" || newVal != ""){
			val = newVal;
		}

		if(val == "" || val != "" && !isimg(val)){
			alert("请选择正确的平台图片");
			return false;
		}

		return true;
	}

</script>
{% endblock %}

{% block main_content %}

<form id="form1" name="form1" action="{%url admin-cooperationplatform-edit platform.id%}"  method="POST" enctype="multipart/form-data">
	<ul id="movie-form" class="form">
	    <li>
            <label for="title">平台名称:</label>
            <input type="text" id="title" name="title" value="{{platform.title}}" class="inputText" />
        </li>
		<li>
            <label for="price">平台网址:</label>
            <input type="text" id="url" name="url" value="{{platform.url}}" class="inputText" />
        </li>
		<li>
            <label for="tuanprice">序号:</label>
            <input type="text" id="index" name="index" value="{{platform.index}}" class="inputText" />
        </li>
		<li>
            <label for="tuanprice">在首页显示:</label>
			{%if platform.showhomepage%}
            <input type="checkbox" id="showhomepage" name="showhomepage" checked="checked"/>
			{%else%}
			<input type="checkbox" id="showhomepage" name="showhomepage"/>
			{%endif%}
        </li>
		<li>
			<label>平台图片:</label><input type="hidden" id="imgurl" name="imgurl" value="{{platform.imgurl}}" />
		</li>
		<li>
			<img src="/static/productimgs/{{platform.imgurl}}" width="130" height="60" style="margin-left:150px">
		</li>
		<li>
			<input type="file" id="file" name="file" style="margin-left:150px"/>
		</li>
		<li>
			<br/>
			<input type="submit" id="btnEdit" value="保存" onclick="return checkData();" style="margin-left:500px"/>
		</li>
	</ul>

</form>

{% endblock %}
